<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <title>我的主页</title>
</head>
<jsp:include page="header.jsp"></jsp:include>
<body style="background: rgb(248, 246, 246);">
<div class="container" style="margin-top: 30px">
    <div class="row">
        <!--左侧1/3部分 -->
        <div class="col-md-3" style="background: transparent;box-shadow: -5px 0 5px rgba(0, 0, 0, 0.03)">

            <!--用户头像-->
            <div class="row">
                <div class="col-md-8 col-md-offset-2">
                    <img src="${sessionScope.userInfo.userImg}" width="150" height="150"
                         style="border-radius: 50%;"/>
                </div>
            </div>

            <!-- 编辑用户资料 -->
            <div class="row">

                <button type="button" style="margin-left: 90px;background: transparent;" class="btn btn-default"
                        data-toggle="modal" data-target="#exampleModal">
                    <span class="glyphicon glyphicon-edit"></span>编辑资料
                </button>

                <div class="modal fade" id="exampleModal" tabindex="-1" role="dialog"
                     aria-labelledby="exampleModalLabel">
                    <div class="modal-dialog" role="document">
                        <div class="modal-content">
                            <div class="modal-header">
                                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
                                        aria-hidden="true">&times;</span></button>
                                <h4 class="modal-title" id="exampleModalLabel">编辑用户资料</h4>
                            </div>
                            <div class="modal-body">
                                <!-- 提交信息表单 -->
                                <form class="form-group" action="/user/editUser" method="post"
                                      enctype="multipart/form-data">
                                    <div class="form-group">
                                        <label>昵称</label>
                                        <input type="text" class="form-control" name="edit_name"
                                               placeholder="这个人很懒什么都没有留下" value="${sessionScope.userInfo.userName}"/>
                                    </div>
                                    <div class="form-group">
                                        <label for="image_file">更换头像</label>
                                        <input type="file" name="edit_image" id="image_file" multiple="multiple">
                                        <p class="help-block">选择你喜欢的头像</p>
                                    </div>
                                    <div class="form-group">
                                        <label>生日</label>
                                        <!--这里展示日期有问题 -->
                                        <input type="date" class="form-control" name="edit_date"
                                               value="">
                                    </div>
                                    <button type="button submit" class="btn btn-primary">提交</button>
                                </form>
                            </div>
                        </div>
                    </div>
                </div>
            </div>

            <!--展示用户信息-->
            <div class="row" style="background: transparent">
                <ul class="list-group" style="background: transparent">
                    <li class="list-group-item" style="background: transparent">
                        昵称:&nbsp;&nbsp;&nbsp;${sessionScope.userInfo.userName}</li>
                    <li class="list-group-item" style="background: transparent">
                        手机:&nbsp;&nbsp;&nbsp;${sessionScope.userInfo.userPhone}</li>
                    <li class="list-group-item" style="background: transparent">生日:&nbsp;&nbsp;&nbsp;<fmt:formatDate
                            value="${sessionScope.userInfo.userDate}"></fmt:formatDate>
                    </li>
                    <li class="list-group-item" style="background: transparent">
                        身份:&nbsp;&nbsp;&nbsp;${sessionScope.userInfo.userStatus ==
                            1?"认证学霸":"普通用户"}</li>
                </ul>
            </div>

            <!-- 展示用户笔记数，问题数，以及粉丝数-->
            <div class="row">
                <div class="col-md-4">
                    <span class="glyphicon glyphicon-pencil">笔记:${sessionScope.userInfo.userNoteCount}</span>
                </div>
                <div class="col-md-4">
                    <span class="glyphicon glyphicon-heart">提问:${sessionScope.userInfo.userIssueCount}</span>
                </div>
                <div class="col-md-4">
                    <span class="glyphicon glyphicon-leaf">粉丝:</span>
                </div>
            </div>
        </div>

        <!-- 主体2/3部分 -->
        <div class="col-md-8" style="margin-left: 20px;box-shadow: -5px 0 5px rgba(0, 0, 0, 0.03)">
            <div class="row">
                <!-- Nav tabs -->
                <ul class="nav nav-tabs" role="tablist">
                    <li role="presentation" class="active"><a href="#notes" aria-controls="notes" role="tab"
                                                              data-toggle="tab">我的笔记</a></li>
                    <li role="presentation"><a href="#goodnotes" aria-controls="goodnotes" role="tab"
                                               data-toggle="tab">我的关注</a></li>
                    <li role="presentation"><a href="#mynotes" aria-controls="mynotes" role="tab"
                                               data-toggle="tab">我的收藏</a></li>
                </ul>

                <!-- Tab panes -->
                <div class="tab-content">
                    <div role="tabpanel" class="tab-pane active" id="notes"
                         style="padding: 15px;border-radius: 2%;">
                        <!-- 展示我的笔记 -->

                        <c:forEach items="${requestScope.userNotes}" var="note">
                            <div class="row">
                                <div class="thumbnail" style="padding: 10px;background: transparent ">
                                    <div class="caption" class="col-md-10 col-md-offset-1">
                                        <h3>${note.noteTitle}</h3>
                                        <p>${note.noteBrief}</p>
                                        <hr>

                                        <div class="row">
                                            <div class="col-md-3 col-md-offset-9">
                                                <button class="btn" style="background: transparent;" data-toggle="modal"
                                                        data-target="#myModal">
                                                    <span class="glyphicon glyphicon-trash"></span>删除
                                                </button>
                                                <!-- 模态框（Modal） -->
                                                <div class="modal fade" id="myModal" tabindex="-1" role="dialog"
                                                     aria-labelledby="myModalLabel" aria-hidden="true">
                                                    <div class="modal-dialog">
                                                        <div class="modal-content">
                                                            <div class="modal-header">
                                                                <button type="button" class="close" data-dismiss="modal"
                                                                        aria-hidden="true">×
                                                                </button>
                                                                <h4 class="modal-title" id="myModalLabel">
                                                                    确认删除${note.noteTitle}
                                                                </h4>
                                                            </div>
                                                            <div class="modal-body">
                                                                不在好好考虑一下么
                                                            </div>
                                                            <div class="modal-footer">
                                                                <button type="button" class="btn btn-default"
                                                                        data-dismiss="modal">关闭
                                                                </button>
                                                                <button id="delete_btn" type="button"
                                                                        class="btn btn-primary">
                                                                    确认
                                                                </button>
                                                            </div>
                                                        </div><!-- /.modal-content -->
                                                    </div><!-- /.modal-dialog -->
                                                </div><!-- /.modal -->
                                            </div>
                                        </div>

                                    </div>
                                </div>
                            </div>
                        </c:forEach>

                    </div>
                    <div role="tabpanel" class="tab-pane" id="goodnotes" style="padding: 15px;border-radius: 2%;">
                        <!-- 展示我的关注用户 -->
                        <div class="list-group" style="background: transparent;">
                            <a href="#" class="list-group-item" style="background: transparent;">
                                <h4 class="list-group-item-heading">关注用户名1</h4>
                                <p class="list-group-item-text">关注用户简介</p>
                            </a>
                            <a href="#" class="list-group-item" style="background: transparent;">
                                <h4 class="list-group-item-heading" style="background: transparent;">关注用户名2</h4>
                                <p class="list-group-item-text">关注用户简介</p>
                            </a>
                            <a href="#" class="list-group-item" style="background: transparent;">
                                <h4 class="list-group-item-heading" style="background: transparent;">关注用户名3</h4>
                                <p class="list-group-item-text">关注用户简介</p>
                            </a>
                        </div>


                    </div>
                    <div role="tabpanel" class="tab-pane" id="mynotes" style="padding: 15px;border-radius: 2%;">
                        <!-- 展示我的收藏笔记 -->

                        我的笔记
                        <div class="row">
                            <div class="thumbnail" style="padding: 10px;background: transparent ">
                                <img src="/images/3.png" alt="...">
                                <div class="caption" class="col-md-10 col-md-offset-1">
                                    <h3>关注blogs</h3>
                                    <p>黑化黑灰化肥灰会挥发发灰黑讳为黑灰花会回飞；灰化灰黑化肥会会挥发发黑灰为讳飞花回化为灰</p>
                                    <hr>
                                    <div class="row">
                                        <div class="col-md-3 col-md-offset-9">
                                            <button class="btn" style="background: transparent;" data-toggle="modal"
                                                    data-target="#myModal2">
                                                <span class="glyphicon glyphicon-heart-empty"></span>取消
                                            </button>
                                            <!-- 模态框（Modal） -->
                                            <div class="modal fade" id="myModal2" tabindex="-1" role="dialog"
                                                 aria-labelledby="myModalLabe2" aria-hidden="true">
                                                <div class="modal-dialog">
                                                    <div class="modal-content">
                                                        <div class="modal-header">
                                                            <button type="button" class="close" data-dismiss="modal"
                                                                    aria-hidden="true">×
                                                            </button>
                                                            <h4 class="modal-title">
                                                                确认取消
                                                            </h4>
                                                        </div>
                                                        <div class="modal-body">
                                                            不在好好考虑一下么
                                                        </div>
                                                        <div class="modal-footer">
                                                            <button type="button" class="btn btn-default"
                                                                    data-dismiss="modal">关闭
                                                            </button>
                                                            <button id="cancel_btn" type="button"
                                                                    class="btn btn-primary">
                                                                确认
                                                            </button>
                                                        </div>
                                                    </div><!-- /.modal-content -->
                                                </div><!-- /.modal-dialog -->
                                            </div><!-- /.modal -->
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
</body>
<jsp:include page="footer.jsp"></jsp:include>
<script>
    $(document).ready(function () {
        //点击删除笔记
        $("#delete_btn").click(function () {
            $.get("url");
        });

        $("cancel_btn").click(function () {
            $.get("url");
        });
    });
</script>
</html>
